/**
 * <p>Title: CarFactory.java>
 * <p>Description: 简单工厂模式-具体工厂类
 * <p>Company: YSS
 * @author yangsongsong
 * @date 2019年1月1日
 */
package com.yss.factory.simple;

public class CarFactory {
	public static Car create(int which) {
		Car car = null;
		switch (which) {
			case 1:
				car = new RedCar();
				break;
			case 2:
				car = new WhiteCar();
				break;
			case 3:
				car = new GreenCar();
				break;
			default:
				System.out.println("没有找到指定类型的汽车");
				break;
		}
		return car;
	}

	public static void main(String[] args) {
		CarFactory.create(1).makeCar();
		CarFactory.create(2).makeCar();
		CarFactory.create(3).makeCar();
	}
}
